//
//  MineCarsManager.m
//  carcareIOS
//
//  Created by ileo on 16/9/2.
//  Copyright © 2016年 chezheng. All rights reserved.
//

#import "MineCarsManager.h"


@implementation MineCarsManager

IMP_SINGLETON

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.initStatus = ManagerDataIniting;
        __weak __typeof(self) wself = self;
        [self updateCarsSuccess:^{
            wself.initStatus = ManagerDataInitSuccess;
        } fail:^{
            wself.initStatus = ManagerDataInitFail;
        }];
    }
    return self;
}

-(void)updateCarsSuccess:(void (^)())success fail:(void (^)())fail{
    __weak __typeof(self) wself = self;
    [NetCar carListSuccess:^(NSArray<CarModel *> *cars) {
        wself.cars = cars;
        if (success) success();
    } fail:fail];
}


@end
